package com.um.jdy.platform.shop.entity.dto;

import com.um.springboot.starter.orm.params.PageDTO;
import com.um.springboot.starter.orm.params.PageParams;
import lombok.Data;

import java.util.Map;

@Data
public class GoodsPageDTO extends PageDTO {

    protected String bigCode;

    protected String code;

    protected String goodsType;

    protected String isUpper;

    protected String shopGoodsName;

    protected String sortName;

    protected String sortType;

    protected String stockType;

    @Override
    public PageParams toPageParams() {
        PageParams pageParams = toPageParams(
                new String[]{"bigCode", "code", "goodsType", "isUpper", "shopGoodsName"},
                new String[]{"big_code", "code", "goods_type", "is_upper", "shop_goods_name"});
        Map condition = pageParams.getCondition();
        condition.put("orderby", sortName + " " + sortType);

        pageParams.setCondition(condition);

        return  pageParams;
    }

}
